/**
 * Created by Administrator on 2017/3/21.
 */
import React, {Component,Fragment} from 'react';
import {Form,  Input ,InputNumber,Radio,TreeSelect,Select,DatePicker,Button,Upload,Icon ,Cascader} from 'antd';
import {connect} from 'dva';
import {download} from '@/utils/utils';
import request from '@/utils/request';
import config from '@/config/config'
import ReactDataGrid from "react-data-grid";
const FormItem = Form.Item;
const Option = Select.Option;
class EditUserArchives extends Component {
  constructor(props) {
    super(props);
    this.state = {
      fileList: [],
      concentrators:[],
      all_protocols:[]
    };
  }
  componentDidMount() {
    // this.props.findChildFunc(this.getState);
    const that=this
  }
  getState=()=>{
    return this.state.fileList
  }
  render() {
    const formItemLayoutWithLabel = {
      labelCol: {
        xs: {span: 24},
        sm: {span: 7},
      },
      wrapperCol: {
        xs: {span: 24},
        sm: {span: 15},
      }
    };
    const props = {
      onRemove: (file) => {
        this.setState(({ fileList }) => {
          const index = fileList.indexOf(file);
          const newFileList = fileList.slice();
          newFileList.splice(index, 1);
          return {
            fileList: newFileList,
          };
        });
      },
      beforeUpload: (file) => {
        this.setState(({ fileList }) => ({
          fileList: [file],
        }));
        return false;
      },
      fileList: this.state.fileList,
    };
    const defaultColumnProperties = {
      resizable: true,
    };
    const {getFieldDecorator, getFieldValue} = this.props.form;

    return (
      <div>
        <Form onSubmit={this.handleSubmit}>
          <FormItem
            label={'类型'}
            {...formItemLayoutWithLabel}
          >
            {getFieldDecorator('fileType', {
              initialValue: '',

            })(
              <Select style={
                {width:'200px'}
              }>
                {[{
                  name:'审计表',
                },{
                  name:'付款凭证',
                }].map((item,index)=>{
                  return <Option key={index} value={item.name}>{item.name}</Option>
                })}

              </Select>
            )}
          </FormItem>
          <FormItem
            {...formItemLayoutWithLabel}
            label={'文件'}
          >
            <div className="dropbox">
              {getFieldDecorator('file', {
              })(
                <Upload.Dragger {...props}>
                  <p className="ant-upload-drag-icon">
                    <Icon type="inbox" />
                  </p>
                  <p className="ant-upload-text">点击这个区域选择文件</p>
                </Upload.Dragger>
              )}
            </div>
          </FormItem>


        </Form>
      </div>
    );
  }
}

const EditUserArchivesFormWrap = Form.create()(EditUserArchives);
export default connect()(EditUserArchivesFormWrap);
